<%@ page contentType="text/javascript"%>
<%@page import="com.javaleague.Constantes"%>

var main;
var mensajes;

window.onload = function() {
    var elementos = new Array('home','classification','messages','writeMessage','calendar','tactics','upload','users','settings','exit');
    for (i=0; i<elementos.length; i++)
        eval( "document.getElementById('" + elementos[i] + "').onclick = probando;" );
    
    main = document.getElementById('main');
    mensajes = new Array();
    $('section#main').load('pages/novedades.jspf');
    $.getScript('<%= Constantes.Rutas.PATCH %>Mensajes?read');
}


function probando() {
    main.innerHTML = "";
    
    switch (this.id) {
        case "home":
            $('section#main').load('pages/novedades.jspf');
            break;
        case "classification":
            $('section#main').load('clasificacion/division1.jspf');
            break;
        case "messages":
            $('section#main').load('pages/mensajes.jsp');
            break;
        case "writeMessage":
            $('section#main').load('pages/writeMessage.jsp');            
            break;
        case "calendar":
            main.innerHTML = '<iframe src="https://www.google.com/calendar/embed?showPrint=0&amp;showCalendars=0&amp;height=600&amp;wkst=2&amp;bgcolor=%23FFFFFF&amp;src=4526lr6ef2mpk7b8rsdp8vmc3k%40group.calendar.google.com&amp;color=%232952A3&amp;ctz=Europe%2FMadrid"></iframe>';
            break;
        case "tactics":
            main.innerHTML = 'Aqu&iacute; puedes elegir entre tres t&aacute;cticas propias';
            break;
        case "upload":
            main.innerHTML = 'No esta disponible el subir una t&aacute;ctica';
            break;
        case "users":
            $('section#main').load('pages/users.jsp');
            break;
        case "settings":
            $('section#main').load('pages/config.jsp');
            break;
        case "exit":
            $('section#main').load('pages/logOut.jsp');
            break;
    }
}

function trim (myString) {
    return myString.replace(/\s+/g,'');
}
